/*
 * @Author: Pure <305737824@qq.com>
 * @CreateTime: 2022-03-18 10:53:38
 * @LastEditors: Pure <305737824@qq.com>
 * @LastEditTime: 2022-03-18 11:32:15
 * @Description:登录API
 */
import Fetch from '@/utils/fetch';

/**
 *  账号密码登录
 * @param {String} password 用户密码
 * @param {String} userName 用户名
 */
const loginWithPWD = ({
  password = null,
  userName = null,
} = {}) => Fetch.post('/login', {
  password,
  userName,
});
/**
 *  科室角色登录
 * @param {Number} id 权限id
 * @param {String} refreshToken 刷新token
 */
const loginWithDept = ({
  id = null,
  refreshToken = null,
} = {}) => Fetch.post('/loginCheck', {
  id,
  refreshToken,
});
/**
 *  刷新jwt
 * @param {String} refreshToken 刷新token
 * @returns
 */
const refresh = (refreshToken) => Fetch.post('/refresh', {
  refreshToken,
});
/**
 * 修改密码
 * @param {String} pwd 新密码
 * @param {String} oldPwd 旧密码
 */
const changePWD = ({
  pwd = null,
  oldPwd = null,
} = {}) => Fetch.post('/sysManager/updatePwd', {
  pwd,
  oldPwd,
});
export default {
  loginWithPWD,
  loginWithDept,
  refresh,
  changePWD,
};
